home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- NNNNAAAAMMMMEEEE
- fsdb - filesystem debugger for EFS
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ffffssssddddbbbb [----????] [----oooo] [----pppp''''_s_t_r_i_n_g''''] [----wwww] _s_p_e_c_i_a_l
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _f_s_d_b is applicable only to EFS filesystems.
-
- _f_s_d_b can be used to patch up a damaged filesystem after a crash. It has
- conversions to translate block and i-numbers into their corresponding
- disk addresses. Also included are mnemonic offsets to access different
- parts of an inode. These greatly simplify the process of correcting
- control block entries or descending the filesystem tree.
-
- Because _f_s_d_b reads the disk raw, it is able to circumvent normal
- filesystem security. It also bypasses the buffer cache mechanism.
- Hence, it is not advisable to use _f_s_d_b to write to a mounted filesystem.
-
- The options available to _f_s_d_b are:
-
- ----???? Display usage.
-
- ----oooo Override some error conditions.
-
- ----pppp''''_s_t_r_i_n_g'''' Set prompt to _s_t_r_i_n_g.
-
- ----wwww Open for write.
-
- _f_s_d_b contains several error-checking routines to verify inode and block
- addresses. These can be disabled if necessary by invoking _f_s_d_b with the
- ----oooo option or by the use of the oooo command.
-
- _s_p_e_c_i_a_l is the name of a character device file. _f_s_d_b searches /_e_t_c/_f_s_t_a_b
- for the raw character device filename, if given the name of a filesystem.
- A buffer management routine is used to retain commonly used blocks of
- data in order to reduce the number of read system calls. All assignment
- operations result in an immediate write-through of the corresponding
- block. Since _f_s_d_b opens the raw device file, any write-throughs bypass
- the filesystem buffer cache, resulting in a potential mismatch between
- on-disk and buffer cache data structures. Hence, it is recommended that
- _f_s_d_b not be used to write to a mounted filesystem. Note that in order to
- modify any portion of the disk, _f_s_d_b must be invoked with the ----wwww option.
-
- Wherever possible, _a_d_b-like syntax was adopted to promote the use of _f_s_d_b
- through familiarity.
-
- Numbers are considered hexadecimal by default. However, the user has
- control over how data are to be displayed or accepted. The _b_a_s_e command
- displays or sets the input/output base. Once set, all input defaults to
- this base and all output is shown in this base. The base can be
- overridden temporarily for input by preceding hexadecimal numbers with
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- 0000xxxx, decimal numbers with 0000tttt, or octal numbers with 0000. Hexadecimal
- numbers beginning with aaaa----ffff or AAAA----FFFF must be preceded with 0000xxxx to distinguish
- them from commands.
-
- Disk addressing by _f_s_d_b is at the byte level. However, _f_s_d_b offers many
- commands to convert a desired inode, directory entry, block, superblock,
- and so forth to a byte address. Once the address has been calculated,
- _f_s_d_b records the result in _d_o_t.
-
- Several global values are maintained by _f_s_d_b: the current base (referred
- to as _b_a_s_e), the current address (referred to as _d_o_t), the current inode
- (referred to as _i_n_o_d_e), the current count (referred to as _c_o_u_n_t), and the
- current type (referred to as _t_y_p_e). Most commands use the preset value
- of _d_o_t in their execution. For example,
-
- > 2:inode
-
- first sets the value of _d_o_t to 2, :::: alerts the start of a command, and
- the _i_n_o_d_e command sets _i_n_o_d_e to 2. A count is specified after a ,,,,. Once
- set, _c_o_u_n_t remains at this value until a new command is encountered,
- which resets the value back to 1 (the default). So, if
-
- > 2000,400/X
-
- is typed, 400 hexadecimal longs are listed from 2000, and when completed
- the value of _d_o_t is 2000 + 400 * sizeof (long). If a carriage return is
- then typed, the output routine uses the current values of _d_o_t, _c_o_u_n_t, and
- _t_y_p_e and displays 400 more hexadecimal longs. An **** causes the entire
- block to be displayed.
-
- End of block and file are maintained by _f_s_d_b. When displaying data as
- blocks, an error message is displayed when the end of the block is
- reached. When displaying data using the _d_b, _d_i_r_e_c_t_o_r_y, or _f_i_l_e commands,
- an error message is displayed if the end of file is reached. This is
- needed primarily to avoid passing the end of a directory or file and
- getting unknown and unwanted results.
-
- Examples showing several commands and the use of carriage return are:
-
- > 2:ino; 0:dir?d
-
- or
-
- > 2:ino; 0:db:block?d
-
- The two examples are synonymous for getting to the first directory entry
- of the root of the filesystem. Once there, subsequent carriage returns
- (or + or -) advance to subsequent entries.
-
- Note that:
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- > 2:inode; :ls /
-
- or
-
- > 2:inode
- > :ls /
-
- is again synonymous.
-
- EEEEXXXXPPPPRRRREEEESSSSSSSSIIIIOOOONNNNSSSS
- _f_s_d_b recognizes the following symbols. There should be no white space
- between the symbols and the arguments.
-
- ccccaaaarrrrrrrriiiiaaaaggggeeee rrrreeeettttuuuurrrrnnnn
- Update the value of _d_o_t by the current value of _t_y_p_e and display
- using the current value of _c_o_u_n_t.
-
- #### Numeric expressions can be composed of +, -, *, and % operators
- (evaluated left to right) and can use parentheses. Once
- evaluated, the value of _d_o_t is updated.
-
- ,,,,_c_o_u_n_t Count indicator. The global value of _c_o_u_n_t is updated to _c_o_u_n_t.
- The value of _c_o_u_n_t remains until a new command is run. A count
- specifier of **** attempts to show a _b_l_o_c_k's worth of information.
- The default for _c_o_u_n_t is 1.
-
- ????_f Display in structured style with format specifier _f (see
- FORMATTED OUTPUT section).
-
- ////_f Display in unstructured style with format specifier _f (see
- FORMATTED OUTPUT section).
-
- .... The value of _d_o_t.
-
- ++++_e Increment the value of _d_o_t by the expression _e. The amount
- actually incremented is dependent on the size of _t_y_p_e:
-
-
- dot = dot + e * sizeof (type)
-
- The default for _e is 1.
-
- ----_e Decrement the value of _d_o_t by the expression _e (see +).
-
- ****_e Multiply the value of _d_o_t by the expression _e. Multiplication
- and division do not use _t_y_p_e. In the above calculation of _d_o_t,
- consider the sizeof ( _t_y_p_e) to be 1.
-
- %%%%_e Divide the value of _d_o_t by the expression _e (see *).
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- <<<<_n_a_m_e Restore an address saved in register _n_a_m_e. _n_a_m_e must be a
- single letter or digit.
-
- >>>>_n_a_m_e Save an address in register _n_a_m_e. _n_a_m_e must be a single letter
- or digit.
-
- ====_f Display indicator. If _f is a legitimate format specifier (see
- FORMATTED OUTPUT section), then the value of _d_o_t is displayed
- using format specifier _f. Otherwise, assignment is assumed (see
- next item).
-
- ====[_e]
-
- ====[_s] Assignment indicator. The address pointed to by _d_o_t has its
- contents changed to the value of the expression _e or to the
- ASCII representation of the quoted (") string _s. This may be
- useful for changing directory names or ASCII file information.
-
- ====++++_e Incremental assignment. The address pointed to by _d_o_t has its
- contents incremented by expression _e.
-
- ====----_e Decremental assignment. The address pointed to by _d_o_t has its
- contents decremented by expression _e.
-
- CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS
- A command must be prefixed by a :::: character. Only enough letters of the
- command to uniquely distinguish it are needed. Multiple commands can be
- entered on one line by separating them by a space, tab, or ;;;;.
-
- In order to view a potentially unmounted disk in a reasonable manner,
- _f_s_d_b offers the _c_d, _p_w_d, _l_s, and _f_i_n_d commands. The functionality of
- these commands substantially matches those of its IRIX counterparts (see
- individual commands for details). The ****, ????, and [[[[----]]]] wildcard characters
- are available.
-
- bbbbaaaasssseeee====_b Display or set base. As stated above, all input and output
- is governed by the current _b_a_s_e. If the ====bbbb is left off, the
- current _b_a_s_e is displayed. Otherwise, the current _b_a_s_e is
- set to _b. Note that this is interpreted using the old value
- of _b_a_s_e. To ensure correctness, use the 0000, 0000tttt, or 0000xxxx prefix
- when changing the _b_a_s_e. The default for _b_a_s_e is hexadecimal.
-
- bbbblllloooocccckkkk Convert the value of _d_o_t to a block address.
-
- ccccdddd _d_i_r Change the current directory to directory _d_i_r. The current
- values of _i_n_o_d_e and _d_o_t are also updated. If no _d_i_r is
- specified, then change directories to inode 2 (////).
-
- ccccgggg Convert the value of _d_o_t to a cylinder group.
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- _d_i_r_e_c_t_o_r_y If the current _i_n_o_d_e is a directory, then the value of _d_o_t is
- converted to a directory slot offset in that directory. _d_o_t
- now points to this entry.
-
- _f_i_l_e The value of _d_o_t is taken as a relative block count from the
- beginning of the file. The value of _d_o_t is updated to the
- first byte of this block.
-
- ffffiiiinnnndddd _d_i_r [----nnnnaaaammmmeeee _n] [----iiiinnnnuuuummmm _i]
- Find files by name or i-number. _f_i_n_d recursively searches
- directory _d_i_r and below for filenames whose i-number matches
- _i or whose name matches pattern _n. Note that only one of the
- two options (----nnnnaaaammmmeeee or ----iiiinnnnuuuummmm) can be used at one time. Also,
- the ----pppprrrriiiinnnntttt is not needed or accepted.
-
- ffffiiiillllllll====_p Fill an area of disk with pattern _p. The area of disk is
- delimited by _d_o_t and _c_o_u_n_t.
-
- _i_n_o_d_e Convert the value of _d_o_t to an inode address. If successful,
- the current value of _i_n_o_d_e is updated as well as the value of
- _d_o_t. As a convenient shorthand, if ::::iiiinnnnooooddddeeee appears at the
- beginning of the line, the value of _d_o_t is set to the current
- _i_n_o_d_e and that inode is displayed in inode format.
-
- llllssss [----RRRR] [----llll] _p_a_t_1 _p_a_t_2 ...
- List directories or files. If no file is specified, the
- current directory is assumed. Either or both of the options
- can be used (but, if used, must be specified before the
- filename specifiers). Also, as stated above, wildcard
- characters are available and multiple arguments can be given.
- The long listing shows only the i-number and the name; use
- the _i_n_o_d_e command with ????iiii to get more information. The
- output is sorted in alphabetical order. If either the ----RRRR or
- the ----llll options is used, then the files can have a character
- following the filename, indicating the type of the file.
- Directories have a ////, symbolic links have a @@@@, AF_UNIX
- address family sockets have a ==== and fifos have an ffff. Regular
- files and block and character device files have an **** if they
- are executable. If the file type is unknown, then a ???? is
- printed.
-
- oooovvvveeeerrrrrrrriiiiddddeeee Toggle the value of override. Some error conditions can be
- overridden if override is toggled on.
-
- pppprrrroooommmmpppptttt _p Change the _f_s_d_b prompt to _p. _p must be surrounded by double
- quotes (").
-
- ppppwwwwdddd Display the current working directory.
-
- qqqquuuuiiiitttt Quit _f_s_d_b.
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- ssssbbbb The value of _d_o_t is taken as the basic block number and then
- converted to the address of the superblock in that cylinder
- group. As a shorthand, ::::ssssbbbb at the beginning of a line sets
- the value of _d_o_t to the superblock and displays it in
- superblock format.
-
- !!!! sssshhhh Escape to shell.
-
- IIIINNNNOOOODDDDEEEE CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS
- In addition to the above commands, there are several commands that deal
- with inode fields and operate directly on the current _i_n_o_d_e (they still
- require the ::::). They can be used to display more easily or change the
- particular fields. The value of _d_o_t is only used by the ::::ddddbbbb, ::::lllleeeennnn, and
- ::::ooooffffffff commands. Upon completion of the command, the value of _d_o_t is
- changed to point to that particular field. For example,
-
- > :ln=+1
-
- increments the link count of the current _i_n_o_d_e and set the value of _d_o_t
- to the address of the link count field. It is important to know the
- format of the disk inode structure and the size and alignment of the
- respective fields; otherwise the output of these commands is not
- coherent. The disk inode structure is available in <_s_y_s/_f_s/_e_f_s__i_n_o._h>.
-
- aaaatttt Access time.
-
- cccctttt Creation time.
-
- ddddbbbb Use the current value of _d_o_t as an index into the list of extents
- stored in the disk inode to get the starting disk block number
- associated with the corresponding extent. Extents number from 0 to
- 11. In order to display the block itself, you need to pipe this
- result into the _b_l_o_c_k command. For example,
-
-
- > 1:db:block,20/X
-
- gets the contents of disk block number field of extent number 1 from
- the inode and converts it to a block address. Twenty longs are then
- displayed in hexadecimal (see the FORMATTED OUTPUT section).
-
- ggggeeeennnn Inode generation number.
-
- ggggiiiidddd Group ID.
-
- llllnnnn Link count.
-
- lllleeeennnn Use the current value of _d_o_t as an index into the list of extents
- stored in the disk inode to get the length associated with the
- corresponding extent. Extents number from 0 to 11. This field is
- one byte long. For example,
-
-
-
-
- PPPPaaaaggggeeee 6666
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
-
- > 1:len/b
-
- displays the contents of the len field of extent number 1.
-
- mmmmtttt Modification time.
-
- mmmmdddd Mode.
-
- mmmmaaaajjjj Major device number.
-
- mmmmiiiinnnn Minor device number.
-
- nnnneeeexxxx Number of extents.
-
- nnnnmmmm Although listed here, this command actually operates on the
- directory name field. Once poised at the desired directory entry
- (using the _d_i_r_e_c_t_o_r_y command), this command allows you to change or
- display the directory name. For example,
-
-
- > 7:dir:nm="foo"
-
- gets the seventh directory entry of the current _i_n_o_d_e and changes
- its name to foo. Names have to be the same size as the original
- name. If the new name is smaller, it is padded with ####. If it is
- larger, the string is truncated to fit and a warning message to this
- effect is displayed.
-
- ooooffffffff Use the current value of _d_o_t as an index into the list of extents
- stored in the disk inode to get the logical block offset associated
- with the corresponding extent. Extents number from 0 to 11. This
- field is three bytes long. For example,
-
-
- > 3:off,3/b
-
- displays the contents of the off field of extent number 3.
-
- sssszzzz File size.
-
- uuuuiiiidddd User ID.
-
- FFFFOOOORRRRMMMMAAAATTTTTTTTEEEEDDDD OOOOUUUUTTTTPPPPUUUUTTTT
- There are two styles and many format types. The two styles are
- structured and unstructured. Structured output is used to display
- inodes, directories, superblocks, and the like. Unstructured output only
- displays raw data. The following table shows the different ways of
- displaying:
-
-
-
-
-
-
- PPPPaaaaggggeeee 7777
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- ????
- cccc Display as cylinder groups
- iiii Display as inodes
- IIII Display as inodes (all direct extents)
- dddd Display as directories
- ssss Display as superblocks
- eeee Display as extents
-
- ////
- bbbb Display as bytes
- cccc Display as characters
- oooo OOOO Display as octal shorts or longs
- dddd DDDD Display as decimal shorts or longs
- xxxx XXXX Display as hexadecimal shorts or longs
-
- The format specifier immediately follows the //// or ???? character. The
- values displayed by ////bbbb and all ???? formats are displayed in the current
- _b_a_s_e. Also, _t_y_p_e is appropriately updated upon completion.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- > :base Display the current input/output base (hexadecimal by
- default).
-
- > :base=0xa Change the current input/output base to decimal.
-
- > 0t2000+(0t400%(0t20+0t20))=D
- Display 2010 in decimal (use of _f_s_d_b as a calculator for
- complex arithmetic). The 0000tttt indicates that the numbers
- are to be interpreted as decimal numbers and are
- necessary only if the current base is not decimal.
- Brackets should be used to force ordering since _f_s_d_b does
- not force the normal ordering of operators. Note that %%%%
- is the division symbol.
-
- > 386:ino?i Display i-number 386 in an inode format. This now
- becomes the current _i_n_o_d_e.
-
- > :ln=4 Change the link count for the current _i_n_o_d_e to 4.
-
- > :ln/x Display the link count as a hexadecimal short.
-
- > :ln=+1 Increment the link count by 1.
-
- > :sz/D Display the size field as a decimal long.
-
- > :sz/X Display the size field as a hexadecimal long.
-
- > :ct=X Display the creation time as a hexadecimal long.
-
- > :mt=t Display the modification time in time format.
-
-
-
-
-
- PPPPaaaaggggeeee 8888
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- > 0:db,3/b Display the block number of the first extent as 3 bytes.
- The block number has to be printed out as bytes, because
- of alignment considerations.
-
- > 0:file/c Display, in ASCII, block zero of the file associated with
- the current _i_n_o_d_e.
-
- > 5:dir:inode; 0:file,*/c
- Change the current inode to that associated with the
- fifth directory entry (numbered from zero) of the current
- _i_n_o_d_e. The first logical block of the file is then
- displayed in ASCII.
-
- > :sb Display the superblock of this filesystem.
-
- > 0:cg?c Display cylinder group information and summary for the
- first cylinder group (cg number 0).
-
- > 7:dir:nm="name"
- Change the name field in the directory slot to _n_a_m_e.
-
- > 2:db:block,*?d
- Display the third block of the current _i_n_o_d_e as directory
- entries.
-
- > 0:db=0x43b Change the disk block number associated with extent 0 of
- the inode to 0x43b.
-
- > 0:len=0x4 Change the length of extent 0 to 4.
-
- > 1:off=0xa Change the logical block offset of extent 1 to 4.
-
- > 0x43b:block/X Display the first four bytes of the contents of block
- 0x43b.
-
- > 0x43b:block=0xdeadbeef
- Set the contents of disk block number 0x43b to
- 0xdeadbeef. 0xdeadbeef may be truncated depending on the
- current _t_y_p_e.
-
- > 2050=0xffffffff
- Set the contents of address 2050 to 0xffffffff.
- 0xffffffff may be truncated depending on the current
- _t_y_p_e.
-
- > 1c92434="this is some text"
- Place the ASCII for the string at 1c92434.
-
- > 2:inode:0:db:block,*?d
- Change the current inode to 2. Take the first block
- associated with this (root) inode and display its
- contents as directory entries. It stops prematurely if
-
-
-
- PPPPaaaaggggeeee 9999
-
-
-
-
-
-
- ffffssssddddbbbb((((1111MMMM)))) ffffssssddddbbbb((((1111MMMM))))
-
-
-
- the EOF is reached.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- fsck(1M), dir(4), efs(4), inode(4).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 11110000
-
-
-
-